<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>广告信息添加</title>

<link href="${ctx}/resources/media/css/chosen.css" rel="stylesheet"
	type="text/css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/bootstrap-wysihtml5.css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/select2_metro.css" />
<script type="text/javascript"
	src="${ctx}/resources/media/js/bootstrap-fileupload.js"></script>
<script type="text/javascript"
	src="${ctx}/resources/media/js/chosen.jquery.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/datetimepicker.css" />
<link rel="stylesheet" href="${ctx}/resources/media/css/dialog.css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/bootstrap-fileupload.css" />
<script type="text/javascript"
	src="${ctx}/resources/media/js/bootstrap-fileupload.js"></script>
<link href="${ctx}/resources/media/css/jquery.fancybox.css"
	rel="stylesheet" />

<link href="${ctx}/resources/media/css/chosen.css" rel="stylesheet"
	type="text/css" />

<link rel="shortcut icon"
	href="${ctx}/resources/media/image/favicon.ico" />
</head>
<body>
	<div class="row-fluid profile">
		<div class="span12">
			<!--BEGIN TABS-->
			<div class="tabbable tabbable-custom tabbable-full-width">
				<ul class="nav nav-tabs">
					<li><a href="${ctx}/advert">广告列表</a></li>
					<li class="active"><a href="${ctx}/advert/add">广告添加</a></li>
				</ul>
				<div class="tab-content">
					<!--end tab-pane-->
					<div class="tab-pane profile-classic row-fluid active" id="tab_1_2">
						<div class="span12">
							<!-- BEGIN SAMPLE FORM PORTLET-->
							<div class="portlet box blue">
								<div class="portlet-title">
									<div class="caption">
										<i class="icon-reorder"></i> <span class="hidden-480">广告添加</span>
									</div>
								</div>
								<!-- END SAMPLE FORM PORTLET-->
								<div class="portlet-body form ">
									<form class="form-horizontal" id="form"
										action="${ctx}/advert/save" method="post"
										enctype="multipart/form-data">
										<fieldset>
											<input id="type" type="hidden" name="type"
												value="0">
												<input id="status" type="hidden" name="status"
												value="0">
											<input
												id="image" type="hidden" name="image"
												value="0">
											<h4 class="form-section">广告添加</h4>
											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">

														<label class="control-label">标题</label>
														<div class="controls">
															<input type="text" id="title" name="title"
																class="m-wrap input-xlarge" value="${banner.title }" maxlength="30">
															<span class="help-inline"></span>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">

														<label class="control-label">链接地址</label>
														<div class="controls">
															<input type="text" name="url" id="url"
																class="m-wrap input-xlarge" value="${banner.url }"
																Onchange="checkInterestRate()" maxlength="200"> <span id="msg"
																style="color: red"></span>
															<p class="help-block"></p>
														</div>
													</div>
												</div>
											</div>
											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">

														<label class="control-label">广告类型</label>
														<div class="controls">
															<input type="text"
																class="m-wrap input-xlarge" value="首页轮播" readonly="readonly">
															<p class="help-block"></p>
														</div>
													</div>
												</div>
												<div class="span6">
                                                    <div class="control-group">

                                                        <!-- Text input-->
                                                        <label class="control-label">产品编号</label>
                                                        <div class="controls">
                                                               <select id="financingId" name="financingId" class="select" style="width:285px">
                                                               <option value=""></option>
                                                               <c:forEach items="${lists }" var="list">
                                                               <c:if test="${banner.financingId== list.id}">
                                                               <option value=${list.id } selected>${list.title }</option>
                                                               </c:if>
                                                               	<c:if test="${banner.financingId!= list.id}">
                                                               <option value=${list.id }>${list.title }</option>
                                                               </c:if>
                                                               </c:forEach>
                                                            </select>
                                                            <p class="help-block"></p>
                                                        </div>
                                                    </div>
                                                </div>
											</div>

											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">
														<!-- Text input-->
														<label class="control-label">展示起始时间</label>
														<div class="controls">
															<div class="input-append date form_meridian_datetime">
																<input size="16" type="text" id="publishTime"
																	name="publishTime"
																	value='<fmt:formatDate value="${banner.publishTime }" pattern="yyyy-MM-dd HH:mm"/>'
																	class="m-wrap"> <span class="add-on"><i
																	class="icon-remove"></i></span> <span class="add-on"><i
																	class="icon-calendar"></i></span>
															</div>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">
														<!-- Text input-->
														<label class="control-label">展示结束时间</label>
														<div class="controls">
															<div class="input-append date form_meridian_datetime">
																<input size="16" type="text" id="expiryTime"
																	name="expiryTime"
																	value='<fmt:formatDate value="${banner.expiryTime }" pattern="yyyy-MM-dd HH:mm"/>'
																	class="m-wrap"> <span class="add-on"><i
																	class="icon-remove"></i></span> <span class="add-on"><i
																	class="icon-calendar"></i></span>
															</div>
														</div>
													</div>
												</div>
											</div>

											<div class="row-fluid">
												<div class="span6">
													<div class="control-group">

														<label class="control-label">排序</label>
														<div class="controls">
															<input type="text" name="sort" id="sort"
																class="m-wrap input-xlarge" value="${banner.sort }" maxlength="10">
															<p class="help-block"></p>
														</div>
													</div>
												</div>
												<div class="span6">
													<div class="control-group">

														<label class="control-label">状态</label>
														<div class="controls">
															<input type="text" 
																class="m-wrap input-xlarge" value="${banner.status==0?'正常':''}" readonly="readonly">
															<input type="hidden" name="status" id="status" value="${banner.status }" />
															<p class="help-block"></p>
														</div>
													</div>
												</div>
											</div>
											
											<div class="row-fluid">
												<div class="span6">
														<div class="control-group">
	                                                        <!-- Text input-->
	                                                        <label class="control-label">产品类型</label>
	                                                        <div class="controls">
	                                                               <select id="productType" name="productType" class="select" style="width:285px">
	                                                               <option value="0">小豆产品</option>
	                                                               <option value="1">美丽产品</option>
	                                                               </select>
	                                                            <p class="help-block"></p>
	                                                        </div>
	                                                    </div>
													</div>
											</div>
											
											<div class="row-fluid">
													<div class="control-group" id="fileUpload">
													<label class="control-label" for="input01">广告图片</label>
													<div class="controls">
														<div class="fileupload fileupload-new" id="f1"
															data-provides="fileupload">
															<div class="row-fluid">
																<c:if test="${banner.image != null}">
																	<div class="span3">
																		<div class="item">
																			<a class="fancybox-button" data-rel="fancybox-button"
																				title="产品图片"
																				href="${imgFtpPath}${banner.image}">
																				<div class="zoom">
																					<img src="${imgFtpPath}${banner.image}"
																						alt="点击浏览产品图片" />
																					<div class="zoom-icon"></div>
																				</div>
																			</a>
																		</div>
																	</div>
																</c:if>
															</div>
															<div class="input-append">
																<div class="uneditable-input">
																	<i class="icon-file fileupload-exists"></i><span
																		class="fileupload-preview"></span>
																</div>
																<span class="btn btn-file"> <span
																	class="fileupload-new">添加产品图片</span> <span
																	class="fileupload-exists">更改</span> <input type="file"
																	name="file" class="default" accept=".jpeg,.jpg,.png"/>
																</span> <a href="#" class="btn fileupload-exists"
																	data-dismiss="fileupload">移除</a>
															</div>
														</div>
													</div>
												</div>
							
											</div>
											
											<div class="row-fluid">
												<div class="control-group">

													<label class="control-label" for="input01">广告内容</label>
													<div class="controls">
														<textarea class="wysihtml5 m-wrap" style="width: 1100px"
															name="content" id="content" rows="6">${banner.content }</textarea>
														<p class="help-block"></p>
													</div>
												</div>
											</div>
										</fieldset>
										<div class="form-actions">
											<button type="submit" class="btn blue ibtsubmit">
												<i class="icon-ok"></i> 保存
											</button>
											<button type="button" onclick="history.go(-1)" class="btn">取消</button>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--END TABS-->
			</div>
		</div>
	</div>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/jquery.dataTables.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/DT_bootstrap.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/select2.min.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/wysihtml5-0.3.0.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/bootstrap-wysihtml5.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/form-advert-validate.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/jquery.validate.min.js"></script>
	<script src="${ctx}/resources/media/js/jquery.fancybox.pack.js"></script>

	<script type="text/javascript"
		src="${ctx}/resources/media/js/chosen.jquery.min.js"></script>
	<script src="${ctx}/resources/media/js/app.js"></script>

	<script src="${ctx}/resources/media/js/gallery.js"></script>
	<script type="text/javascript">
		var dt;
		var count = 1;
		$(function() {
			$("select").select2();

			FormAdvertValidate.init();
			Gallery.init();
			//FormFileUpload.init('${ctx}');

			if ($('.wysihtml5').size() > 0) {
				$('.wysihtml5').wysihtml5({});
			}

		});

		$(".form_meridian_datetime").datetimepicker({
			format : "yyyy-m-d h:i",
			//showMeridian: true,
			language : "zh",
			autoclose : true,
			pickerPosition : (App.isRTL() ? "bottom-right" : "bottom-left"),
			todayBtn : true
		});

	</script>


</body>
</html>